using System;
using System.Collections;
using System.Web.UI.WebControls;
using ConcursoCV.UI.Utiles;
using Curriculum.Services;

namespace ConcursoCV.UI.Clases.ManejadoresControles
{
	/// <summary>
	/// Summary description for ManejadorDropDownListAnios.
	/// </summary>
	public class ManejadorDropDownListAnios : ManejadorControles
	{
		public ManejadorDropDownListAnios()
		{
		}
		public override void Cargar(WebControl ctrl, object value)
		{
			if(value != null)
				((DropDownList)ctrl).SelectedValue = (string) value;
		}
		public override void Inicializar(WebControl ctrl, object value)
		{
			DropDownList dropDownList = ((DropDownList)ctrl);			
			ListItem item;
			foreach (string anio in ListasUtils.GetListaAnios())
			{
				item = new ListItem(anio, anio);
				dropDownList.Items.Add(item);
			}			
		}
		public override string GetValor(WebControl ctrl)
		{
			return ((DropDownList)ctrl).SelectedValue.ToString();
		}
	}
}
